<?php

class Lib {
	
	static function inputYearMonth($key='month'){
		return ($month=fetch_a_string($key)) ? substr($month,0,4).'年'.substr($month, 6).'月' : date('Y年m月');
	}
	
	static function isprint(){
		return isset($_GET['viewtype']);
	}
	
	static function makeTimesRange(){
		$where = array();
		$from = fetch_a_string('from') ? fetch_a_string('from').' 00:00:00' : '';
		$to   = fetch_a_string('to') ? fetch_a_string('to').' 23:59:59' : '';
		if($from)	$where[] = 'addtime>='.strtotime($from);
		if($to)		$where[] = 'addtime<='.strtotime($to);
		return $where ? join(' AND ', $where) : '1';
	}
	
}

?>
